﻿/*
 Plugin for smalljs toolkit
 Copyright (c) 2013 Walter M. Soto Reyes
 http://www.smalljs.com or https://smalljs.codeplex.com
 License: https://smalljs.codeplex.com/license
*/
(function ($) {

    var remove = function (text) {
        return text.replace(/[^a-zA-Z 0-9 ,.-]+/g, '');
    };

    var noChars = function () {

        $('[nochars]').forEach(function () {
            (function (o) {
                $(o).on('keyup', function () {
                    o.value = remove(o.value);
                });
            })(this);
        });

    };

   
    smalljs.plugin({
        removeSpecialChars:function(){
            this.forEach(function(){
                $(this).text(remove($(this).text()));
            });
        }
    });

    smalljs.extend({
        specialChars: {
            remove: remove,
            noChars:noChars
        }
    });


})(sj);